Thread.Priority Property

Syntax

Priority as Integer


Gets and sets the relative priority of the thread. The application's main thread has a priority of 5 and this is also the default value of any programatically created threads.

If you don't modify this value, your application will behave normally, in the sense that all the threads will share the CPU's resources equally. Increasing the value of Priority above 5 gives that thread more processing cycles than other threads. Doubling the value of Priority will double the number of processing cycles the thread gets. A thread with a Priority of 1 will get one-fifth the processing cycles as the main thread. The range is 1 to 2^31-1, but very high values of Priority will make it difficult for other threads to run at all. The value of Priority changes the way in which threads get processing cycles only if their values are not all equal. You can use the following class constants to assign to Priority or to compare its value:

1:LowestPriority

5:NormalPriority

10: HighPriority

You do not need to use these constants; you can use any legal integer value instead.